{% load rest_framework %}

{% if page == "index" %}
  <a href="{% url 'playbook-list' %}" class="nav-link" target="_blank">API</a>
{% elif page == "host_index" %}
  {# provided by the view, host-list or latesthost-list #}
  {% if api_link_url == "host-list" %}
  <a href="{% url 'host-list' %}" class="nav-link" target="_blank">API</a>
  {% else %}
  <a href="{% url 'latesthost-list' %}" class="nav-link" target="_blank">API</a>
  {% endif %}
{% elif page == "task_index" %}
  <a href="{% url 'task-list' %}" class="nav-link" target="_blank">API</a>
{% elif playbook.id %}
  <a href="{% url 'playbook-detail' pk=playbook.id %}" class="nav-link" target="_blank">API</a>
{% elif result.id %}
  <a href="{% url 'result-detail' pk=result.id %}" class="nav-link" target="_blank">API</a>
{% elif task.id %}
  <a href="{% url 'task-detail' pk=task.id %}" class="nav-link" target="_blank">API</a>
{% elif host.id %}
  <a href="{% url 'host-detail' pk=host.id %}" class="nav-link" target="_blank">API</a>
{% elif file.id %}
  <a href="{% url 'file-detail' pk=file.id %}" class="nav-link" target="_blank">API</a>
{% elif record.id %}
  <a href="{% url 'record-detail' pk=record.id %}" class="nav-link" target="_blank">API</a>
{% else %}
  <a href="{% url 'api-index' %}" class="nav-link" target="_blank">API</a>
{% endif %}
